#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    constexpr auto lim {static_cast<int64_t>(2e6)};
    int64_t s0 = 290797;
    int64_t s1 = (s0 * s0) % 50515093;
    vector<pair<int64_t, int64_t>> points {{s0, s1}};
    for (int i = 1; i < lim; ++i) {
        s0 = (s1 * s1) % 50515093;
        s1 = (s0 * s0) % 50515093;
        points.push_back({s0, s1});
    }
    sort(points.begin(), points.end());

    double dmin = 546446.5;
    for (int i = 0; i < points.size(); ++i) {
        for (int j = i + 1; j < points.size(); ++j) {
            auto [x0, y0] = points[i];
            auto [x1, y1] = points[j];
            if (static_cast<double>(x1 - x0) > dmin)
                break;

            double dtmp = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
            if (dtmp < dmin)
                dmin = dtmp;
        }
    }
    int64_t a = static_cast<int64_t>(dmin);
    int64_t b = static_cast<int64_t>((dmin - a + 5e-10) * 1e9);
    cout << a << "." << b << endl;
}   // 20.880613018